package com.gxitsky.utils;

import lombok.extern.slf4j.Slf4j;

/**
 * @author gxing
 * @desc 格式化打印日志
 * @date 2020/9/16
 */
@Slf4j
public class LogUtil {

    /**
     * Formatter And Print Exception Msg
     */
    public static void printErrorMsg(Exception e) {
        StringBuffer sb = new StringBuffer();
        if (e != null) {
            sb.append(e.toString());
            for (StackTraceElement element : e.getStackTrace()) {
                sb.append("\r\n\t").append(element);
            }
        }
        log.error(":{}", sb.toString());
    }
}
